package com.admin.service.impl;

import com.admin.dao.UserDao;
import com.admin.pojo.User;
import com.admin.service.UserService;
import com.four.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;

    /**
     * 手机号密码登录
     * @param
     * @param userPwd
     * @return
     */
    @Override
    public R login(String userName, String userPwd) {
    //根据手机号查询
        User phone1 = userDao.findName(userName);
    //判断手机号是否存在
        if(phone1!=null){
            //判断密码是否一致
            if(userPwd.equals(phone1.getUserPwd())){
                return R.ok().put("100","登录成功");
            }
            return R.error().put("503","登录失败");
        }
        return R.error().put("504","手机号不存在");
    }
}
